package com.fare.taluo.application.impl.fetl.history;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.fare.taluo.application.fetl.history.ISinglePlaneInfoHistoryApplication;
import com.fare.taluo.fetl.domain.entity.history.SinglePlaneInfoHistoryEntity;
import com.fare.taluo.vo.core.PlaneInfo;

@Scope("singleton")
@Service
public class SinglePlaneInfoHistoryApplicationImpl implements
		ISinglePlaneInfoHistoryApplication {
	
	@Override
	public List<PlaneInfo> queryFreightPrice(Date crawlDate, String hbaseKey,String carrierKey,
			String fromCode, String toCode, Date flightDate) throws Exception {
		List<PlaneInfo> results = new ArrayList<PlaneInfo>();
		List<PlaneInfo> list = new SinglePlaneInfoHistoryEntity()
			.list(crawlDate, hbaseKey, fromCode, toCode, flightDate);
		for(PlaneInfo p : list){
			if(p.getCarrierKey().equalsIgnoreCase(carrierKey)){
				results.add(p);
			}
		}
		return results;
	}
}
